#Title: JavaScript Functions : How to Define a Function

To create a function you define its name, any values ("arguments"), and some statements:

function myfunction(argument1,argument2,etc)
{
some statements
}

A function with no arguments must include the parentheses:

function myfunction()
{
some statements
}

Arguments are variables used in the function. The variable values are values passed on by the function call.

By placing functions in the head section of the document, you make sure that all the code in the function has been loaded before the function is called.

Some functions return a value to the calling expression

function result(a,b)
{
c=a+b
return c
}

#Title: JavaScript Functions
#Element: 170: JavaScript Functions